using Hospital.API.HospitalServices.IServices;
using Hospital.API.HospitalServices.Services;
using Hospital.Infrastructrue;
using NLog.Web;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

builder.Services.AddScoped(typeof(IBaseRepository<>), typeof(BasreRepository<>));
builder.Services.AddScoped<IDoctorServices, DoctorServices>();
builder.Services.AddScoped<IWorkflowServices, WorkflowServices>();
builder.Services.AddScoped<IOrderRecordServices, OrderRecordServices>();
builder.Services.AddDbContext<DataDbContext>();
builder.Services.AddWorkflow(p =>
{
    p.UseMySQL(builder.Configuration.GetConnectionString("MySQL"), false, false);
});
builder.Services.AddWorkflowDSL();
builder.Host.UseNLog();
var app = builder.Build();

// Configure the HTTP request pipeline.

    app.UseSwagger();
    app.UseSwaggerUI();


app.UseAuthorization();

app.UseCors(x => x.AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin());

app.MapControllers();

app.Run();
